package com.tangyuan.live.feign;

import com.tangyuan.common.result.Result;
import com.tangyuan.common.result.ResultCodeEnum;
import com.tangyuan.feignapis.live.ILiveRoomFeignClient;
import com.tangyuan.live.service.LiveRoomService;
import com.tangyuan.model.User;
import com.tangyuan.model.live.LiveRoom;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class LiveFeignFeign implements ILiveRoomFeignClient {

    @Autowired
    private LiveRoomService liveRoomService;

    @PostMapping("/feignApi/live/createIMUser")
    @Override
    public Result<ResultCodeEnum> createIMUser(User user) {
        return liveRoomService.createIMUser(user);
    }

    @Override
    @GetMapping("/feignApi/live/getLiveById")
    public LiveRoom getLiveById(Long Id) {
        return liveRoomService.getById(Id);
    }

}
